//
//  KWeiSectionView.m
//  EasyToTesco2.0
//
//  Created by 杨森 on 2017/5/24.
//  Copyright © 2017年 EasyToTesco. All rights reserved.
//

#import "KWeiSectionView.h"

@interface  KWeiSectionView()

@property(nonatomic,strong)UIView    *lineView;

@end
@implementation KWeiSectionView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        [self addSubview:self.englishLabel];
        [self addSubview:self.titleLabel];
        [self addSubview:self.lineView];
        
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat margin = 15;
    
    WeakSelf(self);
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(weakself);
        make.left.equalTo(weakself.mas_left).offset(margin);
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(weakself);
        make.left.equalTo(weakself.titleLabel.mas_right).offset(5);
        make.height.mas_equalTo(weakself.Height/2.5);
        make.width.mas_equalTo(1);
    }];
    
    [self.englishLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(weakself);
        make.left.equalTo(weakself.lineView.mas_right).offset(5);
    }];

}


- (UILabel *)titleLabel
{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = FONT(14);
        _titleLabel.textColor = UIColorFromRGB(0xfa3802);
        _titleLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _titleLabel;
}

- (UILabel *)englishLabel
{
    if (!_englishLabel) {
        _englishLabel = [[UILabel alloc] init];
        _englishLabel.font = FONT(10);
        _englishLabel.textColor = [UIColor lightGrayColor];
        _englishLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _englishLabel;
}


- (UIView *)lineView
{
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = [UIColor lightGrayColor];
        _lineView.layer.masksToBounds = true;
        _lineView.layer.cornerRadius = 2;
    }
    return _lineView;
}




@end
